package cn.lutu.domain.repository.impl;

import cn.lutu.dao.mapper.ArticleUpMapper;
import cn.lutu.domain.repository.ArticleUpRepository;
import cn.lutu.protocol.entity.Up;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class ArticleUpRepositoryImpl implements ArticleUpRepository {
    @Autowired
    private ArticleUpMapper articleUpMapper;

    @Override
    public Integer countById(Long articleId, Long userId) {
        QueryWrapper<Up> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id",userId).eq("article_id",articleId);
        Integer upRows = articleUpMapper.selectCount(wrapper);
        return upRows;
    }
}
